package com.ktwlsoft.archivemanage.payload.study.studyClass;

import com.google.common.base.CaseFormat;
import com.ktwlsoft.archivemanage.domain.dao.entity.study.StudyClassify;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;

/**
 * @author JokerMo
 * @version 1.0
 * @date 2019/12/25 15:34
 */
@Getter
@Setter
public class ClassManagePageRequest {

    @ApiModelProperty("课程分类名称id")
    private Long classifyId;

    @ApiModelProperty("发布开始时间")
    private String publishStart;

    @ApiModelProperty("发布结束时间")
    private String publishEnd;

    @ApiModelProperty("管理状态")
    private String managedState;

    @ApiModelProperty("状态")
    private String state;

    @ApiModelProperty("分页")
    private Integer pn;

    @ApiModelProperty("分页大小")
    private Integer pageSize;

    @ApiModelProperty("关键字：标题，标签，发布人")
    private String keywords;

    @ApiModelProperty("课程类型, 必传项，MANAGE管理端课程, USER用户课程")
    @NotNull(message = "课程类型不能为空")
    private StudyClassify.ClassType classType;

    @ApiModelProperty("排序字段")
    private String orderField;

    @ApiModelProperty("排序方式：descend 倒序，ascend 正序")
    private String orderType;

    public void setOrderField(String orderField) {
        this.orderField = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, orderField);
    }
}